﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="PerfilEdit.aspx.cs" Inherits="PerfilEdit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content" Runat="Server">
    <br />
    <asp:GridView ID="GridView1" align="center" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
        BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" 
        DataSourceID="SqlDataSource1" EnableModelValidation="True" ForeColor="Black" 
        GridLines="Vertical" Height="133px" Width="582px" 
        DataKeyNames="cod_persona">
        <AlternatingRowStyle BackColor="#CCCCCC" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                CancelText="Cancelar" DeleteText="Borrar" EditText="Editar" 
                UpdateText="Actualizar" />
            <asp:BoundField DataField="nombre" HeaderText="nombre" 
                SortExpression="nombre" >
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:BoundField>
            <asp:BoundField DataField="apellido" HeaderText="apellido" 
                SortExpression="apellido" />
            <asp:BoundField DataField="CI" HeaderText="CI" 
                SortExpression="CI" />
            <asp:BoundField DataField="direccion" HeaderText="direccion" 
                SortExpression="direccion" />
            <asp:BoundField DataField="telefono" HeaderText="telefono" 
                SortExpression="telefono" />
            <asp:BoundField DataField="email" HeaderText="email" SortExpression="email" />
        </Columns>
        <FooterStyle BackColor="#CCCCCC" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
    </asp:GridView>
    <br />
    <asp:Button ID="BT_Guardar" runat="server" onclick="BT_Guardar_Click" 
        Text="Guardar" />
    <br />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ventasConnectionString2 %>" 
        
        SelectCommand="SELECT * FROM [persona] WHERE ([cod_persona] = @cod_persona)" 
        DeleteCommand="DELETE FROM [persona] WHERE [cod_persona] = @cod_persona" 
        InsertCommand="INSERT INTO [persona] ([cod_persona], [CI], [nombre], [apellido], [direccion], [telefono], [email]) VALUES (@cod_persona, @CI, @nombre, @apellido, @direccion, @telefono, @email)" 
        UpdateCommand="UPDATE [persona] SET [CI] = @CI, [nombre] = @nombre, [apellido] = @apellido, [direccion] = @direccion, [telefono] = @telefono, [email] = @email WHERE [cod_persona] = @cod_persona">
        <DeleteParameters>
            <asp:Parameter Name="cod_persona" Type="Decimal" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="cod_persona" Type="Decimal" />
            <asp:Parameter Name="CI" Type="String" />
            <asp:Parameter Name="nombre" Type="String" />
            <asp:Parameter Name="apellido" Type="String" />
            <asp:Parameter Name="direccion" Type="String" />
            <asp:Parameter Name="telefono" Type="String" />
            <asp:Parameter Name="email" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:SessionParameter Name="cod_persona" SessionField="New2" Type="Decimal" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="CI" Type="String" />
            <asp:Parameter Name="nombre" Type="String" />
            <asp:Parameter Name="apellido" Type="String" />
            <asp:Parameter Name="direccion" Type="String" />
            <asp:Parameter Name="telefono" Type="String" />
            <asp:Parameter Name="email" Type="String" />
            <asp:Parameter Name="cod_persona" Type="Decimal" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <br />
</asp:Content>

